// 项目管理
module.exports = app=>{
    const {STRING,TEXT,INTEGER} = app.Sequelize;
    const Project = app.model.define('project',{
        id:{
            type:INTEGER,
            unique:true,
            autoIncrement:true
        },
        name:{
            type:STRING,
            unique: true,
            allowNull: false,
            primaryKey: true, // 是否为主键
            comment:'项目名称'
        },
        project_site:{
            type:STRING,
            allowNull:false,
            comment:"项目地址"
        },
        project_sketch:{
            type:TEXT,
            comment:"项目简介"
        },
        project_state:{
            type:STRING,
            allowNull:false,
            commit:"项目状态"
        }       
    })
    Project.associate = function(){
        //一对多班级表
        app.model.Project.hasMany(app.model.Class, { foreignKey: 'project_name', targetKey: 'name'})
    }
    return Project
}